package com.hspedu.homework;

/**
 * 编写老师类
 * 1.要求有属性：姓名name 年龄age 职称post 基本工资salary
 * 2.编写业务方法， introduce(), 实现输出一个教师的信息
 * 3.编写教师类的三个子类：教授类Professor 、副教授类、讲师类。
 * 工资级别分别为：教授为1.3，副教授1.2，讲师1.1
 * 在三个子类里面都重写父类的introduce()方法
 * 4.定义并初始化一个老师对象、调用业务方法，实现对象基本信息的后台打印
 */
public class Homework03 {
    public static void main(String[] args) {
        Teacher professor = new Professor("张三", 20, "教授", 10000);
        Teacher associateProfessor = new AssociateProfessor("李四", 30, "副教授", 10000);
        Teacher lecturer = new lecturer("王五", 40, "讲师", 10000);

        professor.introduce();
        associateProfessor.introduce();
        lecturer.introduce();
    }
}

class Teacher{
    private String name;
    private int age;
    private String post;
    private double salary;


    public Teacher() {
    }

    public Teacher(String name, int age, String post, double salary) {
        this.name = name;
        this.age = age;
        this.post = post;
        this.salary = salary;

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getPost() {
        return post;
    }

    public void setPost(String post) {
        this.post = post;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }



    void introduce(){
        System.out.println("信息" +  "Teacher{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", post='" + post + '\'' +
                ", salary=" + salary +
                '}');
    }
}

class Professor extends Teacher{
    private double grade = 1.3;
    public Professor() {
    }

    public Professor(String name, int age, String post, double salary) {
        super(name, age, post, salary);
    }

    public double getGrade() {
        return grade;
    }

    public void setGrade(double grade) {
        this.grade = grade;
    }

    @Override
    void introduce() {
        System.out.println("教授{" +
                "name='" + super.getName() + '\'' +
                ", age=" + super.getAge() +
                ", post='" + super.getPost() + '\'' +
                ", salary=" + super.getSalary() +
                ", grade=" + this.getGrade() +
                '}');
    }
}
class AssociateProfessor extends Teacher{
    private double grade = 1.2;
    public AssociateProfessor() {
    }

    public AssociateProfessor(String name, int age, String post, double salary) {
        super(name, age, post, salary);
    }

    public double getGrade() {
        return grade;
    }

    public void setGrade(double grade) {
        this.grade = grade;
    }

    @Override
    void introduce() {
        System.out.println("副教授{" +
                "name='" + super.getName() + '\'' +
                ", age=" + super.getAge() +
                ", post='" + super.getPost() + '\'' +
                ", salary=" + super.getSalary() +
                ", grade=" + this.getGrade() +
                '}');
    }
}
class lecturer extends Teacher{
    private double grade = 1.1;
    public lecturer() {
    }

    public lecturer(String name, int age, String post, double salary) {
        super(name, age, post, salary);
    }

    public double getGrade() {
        return grade;
    }

    public void setGrade(double grade) {
        this.grade = grade;
    }

    @Override
    void introduce() {
        System.out.println("讲师{" +
                "name='" + super.getName() + '\'' +
                ", age=" + super.getAge() +
                ", post='" + super.getPost() + '\'' +
                ", salary=" + super.getSalary() +
                ", grade=" + this.getGrade() +
                '}');
    }
}